package com.fqr;

import java.util.Hashtable;
import java.util.List;

public class Infolet extends Hashtable<String, String> {
	
	private static final long serialVersionUID = 9748298329L;
	
	private List<String> properties;
	
	private String name;
	
	private String info;
	
	public String get(String key) {
		String v = super.get(key);
		if(v != null && v.trim().length() > 0)
			return v;
		
		if(info != null && Information.getInstance() != null) {
			Infolet i = Information.getInstance().getInfolet(info);
			if(i != null)
				return i.get(key);
		}
		
		return null;
	}
	
	public void setProperties(List<String> list) {
		for(String s : list) {
			int i = s.indexOf('=');
			if(i > 0)
				put(s.substring(0, i), s.substring(i+1));
			else
				put(s,"");
		}
	}
	
	public List<String> getProperties() {
		return properties;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}
}